#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<stdlib.h>

int main()
{

  //  printf("I am a process...pid:%d\n",getpid());
  //  //程序替换
  //  execl("/home/fsp/linux-code/test/a.out","./a.out",NULL);
  //
  //  printf("HAHAHAHHAHAHHAHA!!!!\n");
  //  printf("HAHAHAHHAHAHHAHA!!!!\n");
  //  printf("HAHAHAHHAHAHHAHA!!!!\n");
  pid_t id = fork();
  if(id==0)
  {
    printf("command begin...\n");
    //execl("/usr/bin/ls","ls","-a","-l",NULL);
    //char* env[]={"MYSELF=2022",NULL};
    //execle("./a.out","./a.out",NULL,env);//把自己定义的环境变量，传入要执行的程序中，使用自己的环境变量
    execl("/usr/bin/python3","python","test.py",NULL);
    printf("command end...\n");
    exit(1);
  }
  //father

  waitpid(id,NULL,0);
  printf("wait child success!!!\n");
  return 0;
}

